﻿using Entity.Blog;
using Entity.Blog.Dto;
using Entity.Blog.Dto.BlogCategory;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service.Blog;
using Service.Finance;

namespace AnQinManagermentBackendAPI.Controller
{
    /// <summary>
    /// 博客系统配置表
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    [AllowAnonymous]
    public class BlogSystemConfigsController : ControllerBase
    {
        /**
         * 业务接口
         */
        private readonly BlogSystemConfigService _service;

        /**
         * 构造函数注入
         */
        public BlogSystemConfigsController(BlogSystemConfigService service)
        {
            _service = service;
        }

        /// <summary>
        /// 获取详情
        /// </summary>
        [HttpGet]
        [ProducesResponseType(typeof(BlogSystemConfig), 200)]
        public async Task<BlogSystemConfig> GetList()
        {
            return await _service.GetAsync();
        }

        /// <summary>
        /// 修改
        /// </summary>
        [HttpPut]
        public async Task<IActionResult> Put([FromBody] BlogSystemConfigUpdateDto model)
        {
            var response = await _service.Put(model);
            return StatusCode(response.Status, response);
        }

    }
}
